package com.liyuhang.domain;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import java.util.UUID;

@Entity
@Table(name = "user")
public class User {

    @Id
    @Column(name = "id" ,unique = true,nullable = false)
    @Setter
    @Getter
    private String id= UUID.randomUUID().toString();

    @Column(name = "username", length = 16)
    @Getter
    @Setter
    @Size(min = 11, max = 14, message = "用户名必须为合法手机号码")
    String username;

    @Column(name = "password", length = 32)
    @Getter
    @Setter
    String password;

    public User() {
    }

    public User(String username, String password) {
        this.username = username;
        this.password = password;
    }

    @Override
    public String toString() {
        return "User{" +
                "username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }





}
